import React from 'react';
import { Table } from 'antd';
const dataSource = [
  {
    id: 1,
    area: '#1',
    name: '1',
  },
  {
    id: 2,
    area: '#1',
    name: '2',
  },
  {
    id: 3,
    area: '#1',
    name: '3',
  },
  {
    id: 4,
    area: '#2',
    name: '4',
  },
  {
    id: 5,
    area: '#2',
    name: '5',
  },
];
const abc = [];
const data = dataSource.map((item, key) => {
  abc.push(item.area);
  return {
    ...item,
    rowSpan:
      abc.filter((o) => o === item.area).length > 1
        ? 0
        : dataSource.filter((o) => o.area === item.area).length,
  };
});
const Index = () => {
  const arr = [];
  const tableProps = {
    columns: [
      {
        title: '区域',
        dataIndex: 'area',
        onCell: (record, index) => {
          return {
            rowSpan: record.rowSpan,
          };
        },
      },
      {
        title: 'name',
        dataIndex: 'name',
      },
    ],
    dataSource: data,
    rowKey: 'id',
  };
  return <Table {...tableProps}></Table>;
};

export default Index;
